class Bean :
    def aa(self):
        pass
    def __init__(self):
        print('init')

class Factory:
    Beans = {}
    def __new__(cls, name, *args, **kwargs):
        if name not in cls.Beans:
            cls.Beans[name] = Bean()
        return cls.Beans[name]
    def __init__(self, name, *args, **kwargs):
        print('init')
b1 = Factory('dsc')
b2 = Factory('dsc')
b3 = Factory('dsc2')
print(b1)
print(b2)
print(b3)
